<template>
  <div id="sendexpress">
    <el-card class="body" body-style="{border-radius: 5%;padding:10px;}">
      <div id="title">我要寄件</div>
    </el-card>
    <div id="express_mes">
      <el-card class="send">
        <div slot="header" class="clearfix">
          <span class="text">寄件人</span>
          <el-button style="float: right" type="danger" size="small" round plain
            >地址簿导入
          </el-button>
        </div>
        <el-form
          :model="ruleForm"
          :rules="rules"
          ref="ruleForm"
          label-width="100px"
          class="demo-ruleForm"
        >
          <el-form-item label="姓名" prop="name">
            <el-input v-model="ruleForm.send.name"></el-input>
          </el-form-item>
          <el-form-item label="联系电话" prop="tel">
            <el-input v-model="ruleForm.send.tel"></el-input>
          </el-form-item>
          <el-form-item label="详细地址" prop="address">
            <el-input v-model="ruleForm.send.address"></el-input>
          </el-form-item>
        </el-form>
      </el-card>
      <el-card class="get">
        <div slot="header" class="clearfix">
          <span class="text">收件人</span>
          <el-button style="float: right" type="danger" size="small" round plain
            >地址簿导入
          </el-button>
        </div>
        <el-form
          :model="ruleForm"
          :rules="rules"
          ref="ruleForm"
          label-width="100px"
          class="demo-ruleForm"
        >
          <el-form-item label="姓名" prop="name">
            <el-input v-model="ruleForm.get.name"></el-input>
          </el-form-item>
          <el-form-item label="联系电话" prop="tel">
            <el-input v-model="ruleForm.get.tel"></el-input>
          </el-form-item>
          <el-form-item label="详细地址" prop="address">
            <el-input v-model="ruleForm.get.address"></el-input>
          </el-form-item>
        </el-form>
      </el-card>
    </div>
    <el-card class="body" body-style="{border-radius: 5%;padding:15px;}">
      <el-form
        :model="ruleForm"
        :rules="rules"
        ref="ruleForm"
        label-width="100px"
        class="demo-ruleForm"
      >
        <el-form-item label="物品信息" prop="message">
          <el-input v-model="ruleForm.message"></el-input>
        </el-form-item>
        <el-form-item label="备注" prop="more">
          <el-input
            type="textarea"
            :rows="4"
            v-model="ruleForm.more"
          ></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="danger" @click="onSubmit">立即下单</el-button>
          <el-button>取消</el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      ruleForm: {
        send: {
          name: "",
          tel: "",
          address: "",
        },
        get: {
          name: "",
          tel: "",
          address: "",
        },
        message: "",
        more: "",
      },
      rules: {
        name: [
          { required: true, message: "寄件人姓名不能为空", trigger: "blur" },
        ],
        tel: [
          { required: true, message: "联系电话不能为空" },
          { type: "number", message: "请输入正确的联系电话" },
        ],
        address: [
          { required: true, message: "寄件地址不能为空", trigger: "blur" },
        ],
        message: [
          { required: true, message: "物品信息不能为空", trigger: "blur" },
        ],
      },
    };
  },
};
</script>

<style scoped>
#title {
  font-size: 24px;
}
.body {
  margin: 10px 0px;
}
.send,
.get {
  display: inline-block;
  width: 46%;
  margin: auto 1.5%;
}
.text {
  font-weight: bold;
}
</style>